import request from "@/utils/request";
import type { ResponsePermission, MenuParam, ResponseData } from "./type";
enum API {
  ALLMENU_URL = "/admin/acl/menu",
  ADDMENU_URL = "/admin/acl/menu/save",
  UPDATEMENU_URL = "/admin/acl/menu/update",
  DELMENU_URL = "/admin/acl/menu/remove"
}

// 获取菜单列表信息
export const reqMenuList = () => request.get<any, ResponsePermission>(API.ALLMENU_URL);
// 修改/新增菜单
export const reqAddOrUpdateMenu = (data: MenuParam) => {
  if (data.id) {
    return request.put<any, ResponseData>(API.UPDATEMENU_URL, data);
  } else {
    return request.post<any, ResponseData>(API.ADDMENU_URL, data);
  }
};
// 删除菜单
export const reqDelMenu = (id: number) => request.delete<any, ResponseData>(API.DELMENU_URL + `?id=${id}`);
